﻿@using www.Controllers
@using www.SService
@{
    ViewBag.Title = "Danh sách quảng cáo";
    Layout = "~/Views/Shared/_LayoutAdmin.cshtml";
}
@Html.ActionLink("Thêm mới", "Add", "Advertise")
<div class="clear"></div>
<div class="content">
    <div class="col-left">Loại</div>
    <div class="col-right">
        @if (ViewData["Type"] != null)
        {
            using (@Html.BeginForm("Index", "Advertise", FormMethod.Post, new { id = "frmad" }))
            {
            @Html.DropDownList("Type", null,new { onchange = "frmad.submit();" ,@class = "combobox"})
            }
        }
    </div>
</div>

<fieldset>
    <legend>Danh sách</legend>
    <div class="clear"></div>
    <table style="width: 100%; height: auto; border: 1px solid #008080;" cellpadding="1" cellspacing="1">
         <tr style="background: #0000cd; color: #fff; height: 30px; font-size: 13px; font-weight: bold;text-align: center;">
                <th style="width: 15%;">Tên </th>
                <th style="width: 10%;">Hình ảnh</th>
                <th style="width: 14%;">Liên kết</th>
                <th style="width: 6%;">Kiểu liên kết</th>
                <th style="width: 13%;">Giá</th>
                <th style="width: 10%;">Ngày bắt đầu</th>
                <th style="width: 10%;">Ngày kết thúc</th>
                <th style="width: 5%;">Thứ tự</th>
                <th style="width: 10%;">Trạng thái</th>
                <th style="width: 7%;">Thao tác</th>
            </tr>
        @if (ViewData["Data"] != null)
        {
            foreach (var item in (List<RelaxAdvertiseDataContract>)ViewData["Data"])
            {
                <tr>
                    <td>@item.Name</td>
                    <td>
                        <img src="@item.Image" style="width: 120px; height: 70px;"/></td>
                    <td>@item.Link</td>
                    <td>@item.Target</td>
                    <td>@item.Price</td>
                    <td>@item.FromDate.ToShortDateString()</td>
                    <td>@item.ToDate.ToShortDateString()</td>
                    <td>@item.Ord</td>
                    <td>@Utility.Active(item.Active)</td>
                    <td>@Html.ActionLink("Sửa","Edit",new{id=item.Id}) | @Html.ActionLink("Xóa","Delete",new{id=item.Id},new {onclick="return confirmDelete();"})</td>
                </tr>
            }
          
        }
      
    </table>
</fieldset>
